package com.fjeld.server.ssl.impl;

import com.fjeld.middleware.activemq.HeartbeatListener;
import com.fjeld.server.ssl.ServerStackLayer;
import com.fjeld.client.gui.ManagementGUI;
import org.apache.log4j.Logger;

import javax.jms.JMSException;
import javax.swing.*;

/**
 * Created by IntelliJ IDEA.
 * User: fjeld
 * Date: 11/12/2011
 * Time: 17:44
 * To change this template use File | Settings | File Templates.
 */
public class HeartbeatListenerStack extends AbstractServerStack implements ServerStackLayer
{
    private static final Logger LOGGER = Logger.getLogger(HeartbeatPublisherStack.class);

    private HeartbeatListener listener;
    public HeartbeatListenerStack() throws JMSException
    {
        LOGGER.info("Initialising");

        // Set up the listener.
        listener = new HeartbeatListener("PUBLISH.HEARTBEAT.>", serverName + ".HeartbeatListener");
        //listener.startConnection();
        LOGGER.info("Finished initialising");
        SwingUtilities.invokeLater(new Runnable() {
            public void run()
            {
                ManagementGUI.main(listener, null, null);
                listener.startConnection();
            }
        });
    }
}
